#include "DeleteCommand.h"

#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsItem>

DeleteCommand::DeleteCommand(QGraphicsScene *scene)
{
    this->selectedItems = scene->selectedItems();
    this->scene = scene;

    this->setText(QString("%1 Deleted Item[s]").arg(this->selectedItems.count()));
}

void DeleteCommand::redo()
{
    foreach (QGraphicsItem *item, selectedItems) {
        scene->removeItem(item);
    }
}

void DeleteCommand::undo()
{
    foreach (QGraphicsItem *item, selectedItems) {
        scene->addItem(item);
    }
}
